<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<form action='linkMovies.do' >

        <tr>
          <td width="71%"> 
    		 <c:set var="usualTimeVar" value=""  />
		  <div align="center" class="boldtext style7"><strong>Link Theaters to Movies </strong></div>
		  </td>
 		 </tr>
        <tr>
          <td width="71%"> 
		  <div align="center" class="boldtext style7"><strong><c:out value="${requestScope.succMsg}" /></strong></div>
		  </td>
 		 </tr> 		 
  
  
        <tr>
          <td class="boldtext style7">
		  &nbsp;&nbsp;&nbsp;
		  <select name="theaterId" onChange="getTimeSlotsAndMoviesByTheater()" >
		  <option>Select a Theater</option>
		  <c:forEach var="theater" items="${requestScope.theaterArr}" >
		  
		  <c:choose>
		  <c:when test="${theater.theaterId eq requestScope.theaterId}" >
            <option value="<c:out value="${theater.theaterId}" />" selected><c:out value="${theater.theaterName}" /></option>
          </c:when>
          <c:otherwise >
            <option value="<c:out value="${theater.theaterId}" />"><c:out value="${theater.theaterName}" /></option>
          </c:otherwise>
		  </c:choose>    
		  </c:forEach>
          </select>		  
		  </td>
        </tr>
		 <tr>
		 <td>
		   <table>
		    <tr>
		      <td height="32">
		      <select name="timeSlotId" size="10"  >
                <c:choose>
                  <c:when test="${empty requestScope.timeSlotArr}">
                    <option>No TimeSlots Exist</option>
                  </c:when>
                  <c:otherwise>
                    <c:forEach var="timeslot" items="${requestScope.timeSlotArr}" varStatus="status">
                      <c:choose>
                        <c:when test="${status.count==1}">
                          <option selected value="<c:out value="${timeslot.timeSlotId}" />" >
                          <c:set var="usualTimeVar"  value="${timeslot.usualTime}"  />
                        </c:when>
                        <c:otherwise>
                          <option value="<c:out value="${timeslot.timeSlotId}" />" > </c:otherwise>
                      </c:choose>SLOT<c:out value="${timeslot.slotNo}" />:                     
                      <c:out value="${timeslot.usualTime}" />
                    </c:forEach>
                  </c:otherwise>
                </c:choose>
              </select>
              </td>
		      <td>
		      <select name="movieId" size="10"  >
               <c:choose>
                 <c:when test="${empty requestScope.movieArr}">
                   <option>No TimeSlots Exist</option>
                 </c:when>
                 <c:otherwise>
                   <c:forEach var="movie" items="${requestScope.movieArr}" varStatus="status">
                     <c:choose>
                       <c:when test="${status.count==1}">
                         <option selected value="<c:out value="${movie.movieId}" />"> 
                           <c:out value="${movie.movieName}" />
                         </option>                         
                       </c:when>
                       <c:otherwise>
						 <option  value="<c:out value="${movie.movieId}" />"> 
                           <c:out value="${movie.movieName}" />
                          </option>    
                       </c:otherwise>
                     </c:choose>          
                   </c:forEach>
                 </c:otherwise>
               </c:choose>
             </select>
             </td>
  	       </tr>
		   </table>
		   <p>
		     Actual Time
		     <input type="text" name="actualTime" />
		   </p>
		   <p>Date Of Show 
		     <input type="text" name="dateOfShow" />
		   (dd/mm/yyyy)</p>
		   <p>
		     <input type="button" name="Submit" value="Submit" onClick="linkMoviesToTheaters()"/>
		     <input type="hidden" name="actionRequest">
		   </p></td>
  	    </tr>
		 <tr>
          <td height="32"><div align="center"></div></td>
        </tr>

</form>